public class Midterm {
	/*
	 * write a method that returns the index of the smallest element in an array
	 * of integers. if the number of such elements is greater than 1, return the
	 * smallest index. use the following header: public static int
	 * indexOfSmallestElement(double[] array)
	 */
	public static void main(String[] args) {
int a[]={2,4,5,6,7,8,1,1};
System.out.println(indexOfSmallestElement(a));
	}
	
	public static int indexOfSmallestElement(int[] array) {
		int index=0;
		int min=array[0];
		for (int i=1;i<array.length;i++) {
			if (array[i]<min) {
			index=i;
			min=array[i];
			}
		}
		return index;
	}
}
